//package com.zhang.authoritycenter.service;
//
//import com.alibaba.fastjson.JSON;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.AuthenticationEntryPoint;
//import org.springframework.stereotype.Service;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * description
// *
// * @author zhangFanJun
// * @date 2023-12-04 17:27
// **/
//@Service
//public class MyAuthenticationEntryPoint implements AuthenticationEntryPoint {
//
//    @Override
//    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException {
//        response.setContentType("application/json;charset=utf-8");
//        Map<String, Object> map = new HashMap<>(4);
//        // 这里写死只做测试  请以实际为主
//        map.put("code", HttpServletResponse.SC_BAD_GATEWAY);
//        map.put("message", "请登录！");
//        response.getWriter().println(JSON.toJSONString(map));
//        response.getWriter().flush();
//    }
//}
